package leetcodecompetition.D349;

/**
 * @Author: Siantar
 * @Date: 2023-06-11-10:42
 * @Description: 1.0
 */
public class T6465 {
    public String smallestString(String s) {
        char[] cs = s.toCharArray();
        boolean l = false;
        for (int i = 0; i < cs.length; i++) {
            if (cs[i] != 'a') {
                cs[i]--;
                l = true;
            } else if (l) {
                break;
            }
        }
        if (!l) {
            cs[cs.length - 1] = 'z';
        }
        return String.copyValueOf(cs);
    }
}
